package com.kevin.common.api;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * 分页实体
 *
 * @author wh
 * @date 2021-06-01
 */
@Data
public class PageDTO {
    @ApiModelProperty(value = "分页页数;默认1")
    private Integer pageNum;

    @ApiModelProperty(value = "分页大小;默认10")
    private Integer pageSize;

    @ApiModelProperty(value = "排序")
    private String orderBy;

    public Integer getPageNum() {
        return pageNum == null ? 1 : pageNum;
    }

    public Integer getPageSize() {
        return (pageSize != null && pageSize > 0) ? pageSize : 10;
    }
}
